#ifndef WF_DRAWLINE_H
#define WF_DRAWLINE_H

#include "pf_previewactioninterface.h"
#include "gui_export.h"

/**
 * This action class can handle user events to draw 
 * simple lines with the start- and endpoint given.
 *
 */
class GUI_EXPORT WF_DrawLine : public PF_PreviewActionInterface {
	Q_OBJECT
public:
    /**
     * Action States.
     */
    enum Status {
        SetStartpoint,   /**< Setting the startpoint.  */
        SetEndpoint      /**< Setting the endpoint. */
    };

public:
    WF_DrawLine(PF_Container& container,
                      PF_GraphicView& graphicView);
    virtual ~WF_DrawLine();

	virtual LX_Define::ActionType rtti() {
		return LX_Define::ActionDrawLine;
	}

	static QAction* createGUIAction(LX_Define::ActionType /*type*/, QObject* /*parent*/);
	
    void reset();

    virtual void init(int status=0);
    virtual void trigger();
	
    virtual void mouseMoveEvent(QMouseEvent* e);
    virtual void mouseReleaseEvent(QMouseEvent* e);
	
	virtual void coordinateEvent(PF_CoordinateEvent* e);
    virtual void commandEvent(PF_CommandEvent* e);
        virtual QStringList getAvailableCommands();
	
	virtual void showOptions();
	virtual void hideOptions();
	
    virtual void updateMouseButtonHints();
    virtual void updateMouseCursor();
    virtual void updateToolBar();

	void close();
	void undo();

protected:
    /**
    * Line data defined so far.
    */
    PF_LineAttribute data;
	/**
	 * Start point of the series of lines. Used for close function.
	 */
	PF_Vector start;

	/**
	 * Point history (for undo)
	 */
        QList<PF_Vector> history;
	
};

#endif
